import heapq
n, m, k = input().strip().split()
sum = 0
data = []
# 读取输入数据并存入堆中
for i in range(int(n)):
    day, s = input().strip().split()
    # 使用负值来模拟最大堆
    sum += int(s)
    heapq.heappush(data, (-int(day), int(s)))
m = int(m)
while m > 0:
    # 取出最大日子
    max_day, s = heapq.heappop(data)
    max_day = -max_day  # 还原为正数
    # 如果最大日子等于 k，退出
    if max_day == int(k) or m-s < 0 or m < sum:
        heapq.heappush(data, (-max_day, s))
        break
    # 更新 m 和 day
    m -= s
    max_day -= 1
    # 将更新后的值重新加入堆
    heapq.heappush(data, (-max_day, s))
# 输出最后的 day
print(-data[0][0])  # 输出最大 day